<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../common/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Metrics</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <jsp:include page="../common/style.jsp"></jsp:include>
</head>

<body class="hold-transition skin-blue-light sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
    <jsp:include page="../header.jsp"/>
    <jsp:include page="../siderbar.jsp"/>
    <div class="content-wrapper">
        <div class=" box  box-solid">
            <section class="content" style="margin-left: 50px">
                <div class="row">
                    <h1 id="forest-metric">forest-metric</h1>

                    <p>基于语义级别具备故障发现和定位能力的业务模调轻量监控系统。 <br>
                        1、语义级别：由业务上报决定成功与否 <br>
                        2、模调：只反应主被调之间的质量,非全路径 <br>
                        3、故障发现：展示和告警 <br>
                        4、定位能力：具备多聚合维度逐层往下界定故障范围的功能 <br>
                        5、业务：适合业务逻辑相关的场景</p>

                    <h2 id="名词解释">名词解释</h2>

                    <ul>
                        <li>1、<code>主题</code>：代表一种统计数据，页面表现为一个独立的图表， <br>
                            例如成功率、延时、发送数、队列长度等
                        </li>
                        <li>2、<code>指标</code>：可以是一个API/Appid或者其他，表示xx的请求数，xx的成功率</li>
                        <li>3、<code>维度</code>：数据聚合的粒度，目前支持指标/版本/isp/idc/host</li>
                    </ul>

                    <h2 id="模块">模块</h2>


                    <h3 id="metrics-client">metrics-client</h3>

                    <p>数据上报的的client</p>

                    <ol start="1">
                        <li rel="1">pom依赖：</li>
                    </ol>

            <pre class="prettyprint hljs-dark"><code class="language-xml hljs"><span class="hljs-tag">&lt;<span
                    class="hljs-title">dependency</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span
                    class="hljs-title">groupId</span>&gt;</span>com.zhizus<span class="hljs-tag">&lt;/<span
                    class="hljs-title">groupId</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span
                    class="hljs-title">artifactId</span>&gt;</span>metrics-client<span class="hljs-tag">&lt;/<span
                    class="hljs-title">artifactId</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span
                    class="hljs-title">version</span>&gt;</span>0.0.1<span class="hljs-tag">&lt;/<span
                    class="hljs-title">version</span>&gt;</span><br><span class="hljs-tag">&lt;/<span
                    class="hljs-title">dependency</span>&gt;</span><br></code></pre>

                    <p>2.上报示例代码：</p>

            <pre class="prettyprint hljs-dark"><code class="language-java hljs">Metrics metrics = Metrics.startWithUri(uri);<span
                    class="hljs-comment">//uri 监控的业务标识</span><br>  <span
                    class="hljs-comment">// 监控业务代码</span><br>  ...<br>  metrics.success();<span class="hljs-comment">// or metrics.failed();</span><br></code></pre>


                    <h3 id="metrics-server">metrics-server</h3>

                    <p>基于thrift协议和mongo的存储的metric server端</p>

                    <p>1.pom依赖：</p>

            <pre class="prettyprint hljs-dark"><code class="language-xml hljs"><span class="hljs-tag">&lt;<span
                    class="hljs-title">dependency</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span
                    class="hljs-title">groupId</span>&gt;</span>com.zhizus<span class="hljs-tag">&lt;/<span
                    class="hljs-title">groupId</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span
                    class="hljs-title">artifactId</span>&gt;</span>metrics-server<span class="hljs-tag">&lt;/<span
                    class="hljs-title">artifactId</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span
                    class="hljs-title">version</span>&gt;</span>0.0.1<span class="hljs-tag">&lt;/<span
                    class="hljs-title">version</span>&gt;</span><br><span class="hljs-tag">&lt;/<span
                    class="hljs-title">dependency</span>&gt;</span><br></code></pre>

                    <p>2示例代码</p>

            <pre class="prettyprint hljs-dark"><code class="language-java hljs"><span class="hljs-keyword">public</span> <span
                    class="hljs-class"><span class="hljs-keyword">class</span> <span
                    class="hljs-title">MetricServer</span> <span class="hljs-keyword">extends</span> <span
                    class="hljs-title">AbstractThriftServer</span> </span>{<br><br>    <span class="hljs-keyword">private</span> MetricsIface iface;<br><br>    <span
                    class="hljs-function"><span class="hljs-keyword">public</span> <span
                    class="hljs-title">MetricServer</span><span class="hljs-params">()</span> </span>{<br>        iface = <span
                    class="hljs-keyword">new</span> MetricsIface();<br>    }<br><br>    <span class="hljs-annotation">@Override</span><br>    <span
                    class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">int</span> <span
                    class="hljs-title">getPort</span><span class="hljs-params">()</span> </span>{<br>        <span
                    class="hljs-keyword">return</span> <span class="hljs-number">6666</span>;<br>    }<br><br>    <span
                    class="hljs-annotation">@Override</span><br>    <span class="hljs-function"><span
                    class="hljs-keyword">public</span> TProcessor <span class="hljs-title">getProcessor</span><span
                    class="hljs-params">()</span> </span>{<br>        <span class="hljs-keyword">return</span> <span
                    class="hljs-keyword">new</span> MetricService.Processor(iface);<br>    }<br><br>    <span
                    class="hljs-function"><span class="hljs-keyword">public</span> <span
                    class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span
                    class="hljs-params">(String[] args)</span> </span>{<br>        <span class="hljs-keyword">new</span> MetricServer().start();<br>    }<br>}<br></code></pre>

                    <h3 id="metrics-web">metrics-web</h3>

                    <p>监控展示web项目</p>

                    <p><img longdesc="./20170106-132333_capture.gif" alt="Alt text" title="" type="image/gif"
                            src=""
                            class=""></p>


                    <p><img longdesc="./20170106-132413_capture.gif" alt="Alt text" title="" type="image/gif"
                            src=""
                            class=""></p></div>

            </section>
        </div>

    </div>
    <jsp:include page="../footer.jsp"/>
    <jsp:include page="../control-siderbar.jsp"/>

</div>
<div class="control-sidebar-bg"></div>
</div>
<jsp:include page="../common/script.jsp"/>

</body>
</html>
